package com.ruoyi.utils;

import java.util.Base64;

public class Base64Utils {


    /**
     * BASE64解密
     *
     * @param key
     * @return
     * @throws Exception
     */
    public static byte[] decryptBASE64(String key) throws Exception {
        Base64.Decoder decoder = Base64.getMimeDecoder();
        return decoder.decode(key);
    }

    /**
     * BASE64加密
     *
     * @param key
     * @return
     * @throws Exception
     */
    public static String encryptBASE64(byte[] key) throws Exception {
        Base64.Encoder encoder = Base64.getMimeEncoder();
        return encoder.encodeToString(key);
    }

}
